var subindex_kv_module_data;
var subindex_middle_banner_module_data;
var subindex_middle_banner_module_data2;
var subindex_navigation_module_data;
var subindex_two_mini_banner_module_data;
var subindex_zwilling_category_info_module_data;
var recommend_module_data;
var mobile_catagory_data;
var pc_catagory_data;
var staub_three_middle_data;
var article_module_data;
var ballarini_three_down_module_data;
var index_favorite_data;
var index_middle_banner_data;
var index_middle_module_data;
var index_mini_two_banner_data;
var index_three_top_module_data;
$(function() {
    var a = jsonData[1];
    $.each(a, function(b, c) {
        if (c.code == "subindex_two_minibanner_module") {
            subindex_two_mini_banner_module_data = c
        } else {
            if (c.code == "subindex_zwilling_category_info_module") {
                subindex_zwilling_category_info_module_data = c
            } else {
                if (c.code == "subindex_middle_banner_module") {
                    subindex_middle_banner_module_data = c
                } else {
                    if (c.code == "subindex_middle_banner_module2") {
                        subindex_middle_banner_module_data2 = c
                    } else {
                        if (c.code == "kv_module") {
                            if (!dataIsNotNull(subindex_kv_module_data)) {
                                subindex_kv_module_data = new Array()
                            }
                            subindex_kv_module_data.push(c)
                        } else {
                            if (c.code == "subindex_navigation_module") {
                                if (!dataIsNotNull(subindex_navigation_module_data)) {
                                    subindex_navigation_module_data = new Array()
                                }
                                subindex_navigation_module_data.push(c)
                            } else {
                                if (c.code == "recommend_module") {
                                    recommend_module_data = c
                                } else {
                                    if (c.code == "staub_mob_three_catagory") {
                                        mobile_catagory_data = c
                                    } else {
                                        if (c.code == "staub_three_middle_moudle") {
                                            staub_three_middle_data = c
                                        } else {
                                            if (c.code == "staub_pc_three_catagory") {
                                                pc_catagory_data = c
                                            } else {
                                                if (c.code == "staub_cook_share") {
                                                    article_module_data = c
                                                } else {
                                                    if (c.code == "ballarini_three_down_moudle") {
                                                        ballarini_three_down_module_data = c
                                                    } else {
                                                        if (c.code == "index_favorite") {
                                                            index_favorite_data = c
                                                        } else {
                                                            if (c.code == "index_middle_banner") {
                                                                index_middle_banner_data = c
                                                            } else {
                                                                if (c.code == "index_middle_moudle") {
                                                                    index_middle_module_data = c
                                                                } else {
                                                                    if (c.code == "index_mini_two_banner") {
                                                                        index_mini_two_banner_data = c
                                                                    } else {
                                                                        if (c.code == "index_three_top_moudle") {
                                                                            index_three_top_module_data = c
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    })
});
function dataIsNotNull(a) {
    if (a == null) {
        return false
    } else {
        if (a == undefined) {
            return false
        } else {
            if (a == "") {
                return false
            } else {
                return true
            }
        }
    }
}
Number.prototype.formatMoney = function(d, g, h, a) {
    d = !isNaN(d = Math.abs(d)) ? d : 2;
    g = g !== undefined ? g : "$";
    h = h || ",";
    a = a || ".";
    var f = this,
        c = f < 0 ? "-" : "",
        e = parseInt(f = Math.abs(+f || 0).toFixed(d), 10) + "",
        b = (b = e.length) > 3 ? b % 3 : 0;
    return g + c + (b ? e.substr(0, b) + h : "") + e.substr(b).replace(/(\d{3})(?=\d)/g, "$1" + h) + (d ? a + Math.abs(f - e).toFixed(d).slice(2) : "")
};
$(function() {
    if (dataIsNotNull(subindex_kv_module_data)) {
        var b = new Vue({
            el: ".vue-kv_module",
            data: {
                kv_module: subindex_kv_module_data,
                kv_count: subindex_kv_module_data.length
            },
            methods: {
                getImgComponentFormat: function(d, c) {
                    return '{"standard":{"high":"", "normal":"' + d + '"},"medium":{"high":"", "normal":"' + d + '"},"small":{"high":"", "normal":"' + c + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(subindex_kv_module_data)) {
        var a = new Vue({
            el: ".vue-kv_module_txt",
            data: {
                kv_modlue_txt: subindex_kv_module_data
            }
        })
    }
    if (dataIsNotNull(mobile_catagory_data)) {
        vm4 = new Vue({
            el: "#catagoryMob",
            data: {
                mobile_catagory_data: mobile_catagory_data
            }
        })
    }
    if (dataIsNotNull(pc_catagory_data)) {
        vm5 = new Vue({
            el: "#catagoryPc",
            data: {
                pc_catagory_data: pc_catagory_data
            },
            methods: {
                getImgComponentFormat: function(d, c) {
                    return '{"standard":{"high":"", "normal":"' + d + '"},"medium":{"high":"", "normal":"' + d + '"},"small":{"high":"", "normal":"' + c + '"}}'
                }
            }
        })
    }
});
$(function() {
    if (dataIsNotNull(subindex_middle_banner_module_data)) {
        var a = new Vue({
            el: ".vue-subindex_middle_banner_module",
            data: {
                subindex_middle_banner_module: subindex_middle_banner_module_data
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(subindex_middle_banner_module_data2)) {
        var a = new Vue({
            el: ".vue-subindex_middle_banner_module2",
            data: {
                subindex_middle_banner_module2: subindex_middle_banner_module_data2
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(index_middle_banner_data)) {
        var e = new Vue({
            el: ".vue-index_middle_banner_module",
            data: {
                index_middle_banner_data: index_middle_banner_data
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                },
                getImageParse: function(f) {
                    return "background: url(" + f + ") 50% 164.1px / 100% 100% no-repeat fixed; height: 528px;"
                }
            }
        })
    }
    if (dataIsNotNull(index_middle_module_data)) {
        var c = new Vue({
            el: ".vue-index_middle_module",
            data: {
                index_middle_module_data: index_middle_module_data,
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(index_three_top_module_data)) {
        var d = new Vue({
            el: ".vue-index_three_module",
            data: {
                index_three_top_module_data: index_three_top_module_data
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(ballarini_three_down_module_data)) {
        var b = new Vue({
            el: ".vue-middle_three_down",
            data: {
                staub_three_middle_data: ballarini_three_down_module_data
            },
            methods: {
                getImgComponentFormat: function(g, f) {
                    return '{"standard":{"high":"", "normal":"' + g + '"},"medium":{"high":"", "normal":"' + g + '"},"small":{"high":"", "normal":"' + f + '"}}'
                }
            }
        })
    }
});
$(function() {
    if (dataIsNotNull(subindex_navigation_module_data)) {
        var a = new Vue({
            el: ".vue-subindex_navigation_module",
            data: {
                subindex_navigation_module: subindex_navigation_module_data
            }
        })
    }
});
$(function() {
    if (dataIsNotNull(subindex_two_mini_banner_module_data)) {
        var a = new Vue({
            el: ".vue-subindex_two_minibanner_module",
            data: {
                subindex_two_minibanner_module: subindex_two_mini_banner_module_data
            },
            methods: {
                getImgComponentFormat: function(c, b) {
                    return '{"standard":{"high":"", "normal":"' + c + '"},"medium":{"high":"", "normal":"' + c + '"},"small":{"high":"", "normal":"' + b + '"}}'
                }
            }
        })
    }
    if (dataIsNotNull(index_mini_two_banner_data)) {
        var a = new Vue({
            el: ".vue-index_two_minibanner_module",
            data: {
                index_two_minibanner_module: index_mini_two_banner_data
            },
            methods: {
                getImgComponentFormat: function(c, b) {
                    return '{"standard":{"high":"", "normal":"' + c + '"},"medium":{"high":"", "normal":"' + c + '"},"small":{"high":"", "normal":"' + b + '"}}'
                }
            }
        })
    }
});
$(function() {
    if (dataIsNotNull(subindex_zwilling_category_info_module_data)) {
        var b = new Vue({
            el: ".vue-subindex_zwilling_category_info_module",
            data: {
                subindex_zwilling_category_info_module: subindex_zwilling_category_info_module_data
            }
        })
    }
    if (dataIsNotNull(index_favorite_data)) {
        var a = new Vue({
            el: ".vue-index_favorite_info_module",
            data: {
                index_favorite_data: index_favorite_data
            }
        })
    }
});
$(function() {
    if (dataIsNotNull(recommend_module_data)) {
        var e = "";
        var g = recommend_module_data.data.custom_code;
        if (g != null && g.trim() != "") {
            var k = {
                recommendId: g.trim(),
                type: "4"
            };
            e = loxia.syncXhrGet("/item/showItemRecommend", k)
        } else {
            var a = recommend_module_data.data.recommendItems.trim();
            var k = {
                itemCodes: a
            };
            e = loxia.syncXhrGet(base + "/item/showItemRecommendByItemCodes", k)
        }
        if (e.length == 0 || e.exception != null) {
            $("#rec-module").hide()
        }
        var b = new Vue({
            el: ".vue-recommend_module",
            data: {
                recommend_item_data: e,
                recommend_module: recommend_module_data
            },
            methods: {
                getImg: function(i) {
                    return imgbase + c(i)
                },
                getHref: function(i) {
                    return "/item/" + i
                },
                formatPrice: function(l, i) {
                    if (l != i) {
                        return "<span class='goods-price'>" + l.formatMoney(2, "￥") + "<del class='original-price'>" + i.formatMoney(2, "￥") + "</del></span>"
                    } else {
                        return "<span class='goods-price one-price'>" + l.formatMoney(2, "￥") + "</span>"
                    }
                }
            }
        })
    }
    function c(n) {
        var i = "";
        var m = n.lastIndexOf(".");
        var l = n.lastIndexOf("_");
        if (l != -1) {
            i = n.substring(0, l)
        } else {
            i = n.substring(0, m)
        }
        i += "_250X250" + n.substring(m);
        return i
    }
    if (dataIsNotNull(article_module_data)) {
        var d = article_module_data.data.recommenditems.trim().split("\n");
        var j = "";
        for (var f = 0; f < d.length; f++) {
            j = j + d[f] + ","
        }
        var a = j.substring(0, j.length - 1);
        var k = {
            codes: a
        };
        var e = loxia.syncXhrGet(base + "/cms/articleListByCodes.json", k);
        var h = new Vue({
            el: ".vue-staub_article_module",
            data: {
                recommend_article_data: e,
                article_module_data: article_module_data
            },
            methods: {
                getImgComponentFormat: function(l, i) {
                    return '{"standard":{"high":"", "normal":"' + l + '"},"medium":{"high":"", "normal":"' + l + '"},"small":{"high":"", "normal":"' + i + '"}}'
                }
            }
        })
    }
});
$(function() {
    var a = $(".events-home-kv");
    var b = new Swiper(a, {
        pagination: ".swiper-pagination",
        nextButton: ".swiper-button-next",
        prevButton: ".swiper-button-prev",
        onInit: function(c) {
            $(c.container).data("swiper", c)
        }
    });
    $(".e-subpage-nav-tab ul li").on("tap", function() {
        var c = $(this).index();
        $(this).addClass("is-active").siblings().removeClass("is-active")
    });
    $(window).on("resize.subpageNav", function() {
        var d = $.spice.getWindowWidth();
        if (d < 1024) {
            $(".e-subpage-nav-tab ul li").on("tap", function() {
                var e = $(this).index();
                $(".e-slides-per-view").data("swiper") && $(".e-slides-per-view").data("swiper").update();
                c.slideTo(e, 500, false)
            });
            var c = new Swiper(".e-subpage-slides", {
                slidesPerView: "auto",
                onInit: function(e) {
                    $(e.container).data("swiper", e);
                    setTimeout(function() {
                        e.update()
                    }, 300)
                }
            })
        }
    }).trigger("resize.subpageNav");
    ZL.mySwiperGallery(".popularity-product-box", 4, 2);
    $(".e-staub-video").on("tap", function(d) {
        d.preventDefault();
        var f = $(this),
            c = f.data("videoCode");
        ZL.subOpenVideo(c, "true")
    });
    $.spice.lazyLoad("img[lazy-src]");
    $.spice.tools.changeImageSrc()
});